# Importing Data
CZECK<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "I1:I239")

# Checking the Imported Data
View(CZECK)
# Creating Time Series Data
Czeck_ts <- ts(CZECK, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
Czeck_ts
sum(is.na(Czeck_ts))
library(forecast)
Czeck_ts <- tsclean(Czeck_ts)
Czeck_ts

# Identification: Plotting the Time Series Data
plot(Czeck_ts)

# Estimating the appropriate model
Czeck_ts_model <- auto.arima(Czeck_ts)
Czeck_ts_model

# Forecasting
options(max.print=1000000)
Czeck_ts_forecast <- forecast (Czeck_ts_model, level=c(95), h=255)
plot(Czeck_ts_forecast)
Czeck_ts_forecast             

# Exporting
write.table(Czeck_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/CZECK_TSA.csv", sep=",")
